opendir(DH,"</home/uec-00/yapingli/data/Terry/all_offline/") or die;
foreach my $file(readdir(DH)){
	if($file=~/(methylCGsRich_IMR90GNOMe-815C5ABXX-81B71ABXX)_(chr\S+).txt/){
		my $sample=$1;
		my $chr=$2;
		my $table=$sample."_".$chr;
		my $create_table = "CREATE TABLE `$table` \(
		  `chromPos` INT UNSIGNED NOT NULL,
		  `strand` enum('+','-') NOT NULL,
		  `totalReads` SMALLINT UNSIGNED NOT NULL,
		  `cReads` SMALLINT UNSIGNED NOT NULL,
		  `cReadsNonconversionFilt` SMALLINT UNSIGNED NOT NULL,
		  `tReads` SMALLINT UNSIGNED NOT NULL,
		  `agReads` SMALLINT UNSIGNED NOT NULL,
		  `totalReadsOpposite` SMALLINT UNSIGNED NOT NULL,
		  `aReadsOpposite` SMALLINT UNSIGNED NOT NULL,
		   `preBaseGreads` SMALLINT UNSIGNED NOT NULL default '0',
		   `preBaseTotalReads` SMALLINT UNSIGNED NOT NULL default '0',
		   `preBaseRefUpperCase` CHAR(1),
		  `nextBaseGreads` SMALLINT UNSIGNED NULL default '0',
		  `nextBaseTotalReads` SMALLINT UNSIGNED NULL default '0',
		  `nextBaseRefUpperCase` CHAR(1),
		  `fracMeth` FLOAT(5,2) NOT NULL,
		  `fracPreBaseG` FLOAT(5,2) NOT NULL,
		  `fracNextBaseG` FLOAT(5,2) NOT NULL,
		  `gchWeight` FLOAT(5,2) NOT NULL,
		  `gcgWeight` FLOAT(5,2) NOT NULL,
		  `hcgWeight` FLOAT(5,2) NOT NULL,
		  PRIMARY KEY chromPos(chromPos)
		\)\;";

		my $com = $create_table." | mysql -u yaping -p -h epifire2.epigenome.usc.edu gnome_seq < lyping1986 ";
		system("$com");
	}
}